<?php
/**
 * Created by PhpStorm.
 * User: Kau
 * Date: 2018/3/21
 * Time: 2:06
 */
namespace app\bis\controller;

use think\Controller;
use think\facade\Session;

abstract class Base extends Controller
{
    public $account;
    public function __construct()
    {
        parent::__construct();
        if (!$this->isLogin())
        {
            $this->redirect('login/index');
        }
    }

    protected function isLogin()
    {
        $user = $this->getLoginUser();
        if ($user && $user->id)
        {
            return true;
        }
        return false;
    }

    protected function getLoginUser()
    {
        if (!$this->account)
        {
            $this->account = Session::get('bisAccount', 'bis');
        }

        return $this->account;
    }
}